package server.net;

import java.io.*;
import java.nio.ByteBuffer;

public class PlayerBuffers {

	private ByteBuffer inBuffer = ByteBuffer.allocate(1024);
	private ByteBuffer outBuffer = ByteBuffer.allocate(1024);

	public void write(byte b) {
		outBuffer.put(b);
	}
	
	public void write(byte[] b) {
		outBuffer.put(b);
	}

	public void writeObject(Object o) {
		try {
			ByteArrayOutputStream baos = new ByteArrayOutputStream();
			new ObjectOutputStream(baos).writeObject(o);
			byte[] byteVal = baos.toByteArray();
			write(byteVal);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public ByteBuffer getInBuffer() {
		return inBuffer;
	}

	public ByteBuffer getOutBuffer() {
		return outBuffer;
	}
	
	public void createPacket(int opcode, Object ... data) {
		
	}

}
